package demo1;

public class Homework4 {
		public static void main(String[] args) {
		int i;
		int [] count = new int[1000];
		count[0] = 2;count[1] = 3;count[2] = 5;count[3]=7;
		int index = 4;
		for(i=1;i<=1000;i++)
		{
			if(i%2!=0&&i%3!=0&&i%5!=0&&i%7!=0){
				if (i<100){
					if (i%10 == i/10){
						count[index]=i;
						index++;
					}
				}
				if(i>=100&&i<=1000){
					if(i%10 == i/100){
						count[index]=i;
						index++;
					}
				}
			}
		}
		for (int aa=0;aa<index;aa++){
			System.out.print(count[aa]);
			System.out.print(" ");
			if ((aa+1)%10 == 0){
				System.out.print("\n");
			}
		}
	}
}
